# -*- coding: utf-8 -*-
# @Time    : 2024/3/22 15:00
# @Author  : ZSQ
# @Email   : zsq199170918@163.com
# @FileName: m_anjuke_font.py
# @Software: PyCharm

import base64
from fontTools.ttLib import TTFont
import hashlib
from io import BytesIO
import os
from glob import glob
from lxml import etree
from uuid import uuid1
from pathlib import Path
from difflib import SequenceMatcher

FONT_DICT = {'a65b3eadb4073d825f4440397de6892e': '4', '6aa4d21fb697c3f73e488c98ec047adb': '5',
             '90cffa7a751b5550f59ba2b804c69a39': '0', '268928cad2c381ec9d52b2b2cd55b8af': '01',
             'f2a48cc9609a4d171968d5a369c8c269': '02', '872260796c26dd9bc3371095efae6a28': '1',
             'ace8644f4e704e2ea5e9c048d93817e3': '10', 'bf0e6d78aab87428f4146b1848382906': '12',
             'c1cb440522ead17f4053855d153643a6': '2', '74d826032c6583f2824910688a141427': '20',
             '24379bbfd83c56f3a9d785b9524eeeae': '21', '4a10179e822c130f23727d82f218b20d': '3',
             '95ec1c3435c97f2c716ca06ea7c786b7': '6', '0d17bad610e5deebde9b048498d6e752': '7',
             '9ea8eab478df034aa4dccca0b4d21cbc': '8', '5e87d3e78057b3cf7fc99168c8c95e5b': '9',
             'b35ecd6fa3187eac4c36dffcf1df3fb5': 'a', 'd7a3e17d87749190b386c87b8125c0d7': 'A',
             '9361c4ef623f1e1d44ab425ef25d431b': 'B', '96ed533d79a0baeef611bcb97dc17f92': 'b',
             'f84b9710c25a8ac9924f629a28645ff7': 'C', '68522e1cc0b12fb817bd42c2528d05e5': 'c',
             'd9196df69b0cad0af70f08a048e35730': 'D', '446a13737596bde1661c30d3fdf886de': 'd',
             '5a780c78ba3c07fd645459ba5bda1689': 'E', '9d38cbfe7b914e2732829e24851f0b0f': 'e',
             '0a125238e75b84543bd3f189c9ec4633': 'F', '25dbfd3900e422c555f789cc59d88348': 'f',
             '17b80c162b7e87637dbd703ad0d5f74c': 'g', 'cbbd50a7cf60c7f8c49083a1edc43a81': 'G',
             '22c695c43488a76a1b3bc6183c0daea2': 'h', 'b654a9f5ca70489e162080723b95ef82': 'H',
             'e69cb46890b7b805fc6029006b951bd6': 'i', '085c9b6f207af36f30f12f99e54ebca6': 'I',
             '3c058fd681d3a74f32a23980f613b084': 'J', '0248ca6152ea8d3023edafa938a0c62d': 'j',
             '2fd0c9eaa1b022d1729760e8a23c0489': 'K', '08d7a3553f1a79d3b24130abf0ab9e67': 'k',
             '558f9128b14f3dd03917ec65b4aa96c3': 'l', '9458fbeca590f378a39d7ddef5226776': 'L',
             '27c044fc29e738f59f513b26fabe066c': 'M', '7c81896515e64e5287f981c56f04e727': 'm',
             '47600b72c2a5e32c3ec8b2d9b36d63b9': 'N', 'e3b57509fdd17f06e818c6a434a4deaf': 'n',
             '0808bccebc7cac4e6d8b9e88cb2e4afc': 'o', '3fe304d8bab9a935cda6c05e3aea9024': 'O',
             '5e4d7be6f2b5f8177d83c7839da29187': 'p', '8276ec09f71e6115f9df93b1b2697b05': 'P',
             '1da34d75cfd2e21ebfb901f8abd3e2b2': 'q', '9660965396ceb4e31467d68c159d1c44': 'Q',
             '4860e02841d60a095330c48d9221a954': 'r', '9f89e54955adfd79383db032c663b359': 'R',
             '4f9c73736b9167a91ad6b0347c429667': 's', 'ab0e1dac2685397177f442b04df5139e': 'S',
             'd07822c4abc6d2f66f861abb36bdfcaa': 't', '3e99b5aa351bda4980b51b942be1991a': 'T',
             '844e2e18ec8e45db0877f772c2460ac7': 'U', 'aa392ed215d4de9c64229b68b4005aac': 'u',
             'c2c2782fbb28b23d44d414dcfbc26adb': 'v', '032785443ef6dd15f51dba578c3df450': 'V',
             '577277a9cedeb4d0af2983e1ac425ed2': 'w', '714a2b10db75a6e6281bd82367f9f998': 'W',
             '325b2dfa92dee53ed857168313b6c9d0': 'x', '919a4377a26cc9c0d845ea1775da7489': 'X',
             '9650ee781200a80f0db4677213f9978a': 'y', '66906ebad5a926949f3890e7d26f272f': 'Y',
             'be78af95909b2343e7db2c658e053c7a': 'z', 'ec2218a1deda81b25bfd74d092126f2f': 'Z',

             '6fedfcb9ef63bbf652f733f2e412dd4a': '7', 'a1661e6294855b10c87dffba956bfd72': '0',
             'd4855976c778b7d2c837b72ff85f685a': '2', '969d23613709118aac2d36a34f928e83': '1',
             'be8e13c3badb9ddf9b445d4831a8dbc7': '3', 'e5b4d5def3322b5a1d01d88498a1e037': '9',
             'df5103c46a5a6d2d87d610247e1ed9e0': '8', '1accc62ab6fec9c67388f654813ff310': '5',
             }
sample_font: dict = {
    '7_f34230ba-fe30-11ee-a289-94de80a79d0c': '111111111',
    '0_f3427edc-fe30-11ee-bb9c-94de80a79d0c': '101001101010101100100',
    '6_f342a5ee-fe30-11ee-a133-94de80a79d0c': '10100110100100100100101100100100100',
    '2_f342a5ef-fe30-11ee-bcbf-94de80a79d0c': '1001001011010101011011111111',
    '1_f342a5f0-fe30-11ee-a751-94de80a79d0c': '11111111111',
    '3_f342a5f1-fe30-11ee-aa1b-94de80a79d0c': '1011110101011010010110110100101101001',
    '4_f342a5f2-fe30-11ee-9042-94de80a79d0c': '1111111111111011011',
    '9_f342a5f3-fe30-11ee-89a7-94de80a79d0c': '1010010101010101010101010101100100100100',
    '8_f342ccfe-fe30-11ee-93d7-94de80a79d0c': '1010101010101101010101010110010010101010010010',
    '5_f342ccff-fe30-11ee-8def-94de80a79d0c': '100101111110101011010101101001',
    '5_f343422e-fe30-11ee-809f-94de80a79d0c': '100101111110101101010101101001',
    '4_f3436940-fe30-11ee-8716-94de80a79d0c': '1111111111111011011',
    '7_f3436941-fe30-11ee-8369-94de80a79d0c': '111111111',
    '0_f3436942-fe30-11ee-8516-94de80a79d0c': '101011010110100100110101',
    '8_f3436943-fe30-11ee-a682-94de80a79d0c': '1010101010101101010101010110010010101010010010',
    '6_f3436944-fe30-11ee-9c2f-94de80a79d0c': '10100110100100100100101100100100100',
    '9_f3439050-fe30-11ee-b98b-94de80a79d0c': '10100101010010010101010101100100100100',
    '1_f3439051-fe30-11ee-99d7-94de80a79d0c': '111111111111',
    '3_f3439052-fe30-11ee-b99e-94de80a79d0c': '101011010011011001001011010010111101',
    '2_f3439053-fe30-11ee-b749-94de80a79d0c': '1001001011010101011011111111',
    '6_f3442c92-fe30-11ee-bd97-94de80a79d0c': '10100110100100100100101100100100100',
    '2_f3442c93-fe30-11ee-97a6-94de80a79d0c': '1001001011010101010111111111',
    '9_f3442c94-fe30-11ee-a4a8-94de80a79d0c': '1010010101010101010101010101100100100100',
    '0_f3442c95-fe30-11ee-90de-94de80a79d0c': '1010110101010110100100',
    '4_f3442c96-fe30-11ee-8002-94de80a79d0c': '1111111111111011011',
    '5_f34453a4-fe30-11ee-9131-94de80a79d0c': '111111101010101010110100100101',
    '1_f34453a5-fe30-11ee-88a3-94de80a79d0c': '111111111111',
    '3_f34453a6-fe30-11ee-aefb-94de80a79d0c': '101011010011011001001011010010111101',
    '8_f34453a7-fe30-11ee-bc47-94de80a79d0c': '1010101010101101010101010110010010101010010010',
    '7_f34453a8-fe30-11ee-a5b0-94de80a79d0c': '111111111',
    '2_f344c8d4-fe30-11ee-a710-94de80a79d0c': '1001001011010101010111111111',
    '3_f344efe4-fe30-11ee-9c3f-94de80a79d0c': '101111010101101001011001100101101001',
    '9_f344efe5-fe30-11ee-a6db-94de80a79d0c': '1010010101010101010101010101100100100100',
    '1_f344efe6-fe30-11ee-94fd-94de80a79d0c': '111111111111',
    '8_f344efe7-fe30-11ee-b001-94de80a79d0c': '1010101010101101010101010110010010101010010010',
    '5_f344efe8-fe30-11ee-ab0a-94de80a79d0c': '100101111110101101010101101001',
    '0_f344efe9-fe30-11ee-afb6-94de80a79d0c': '101001101010101100100',
    '6_f34516f6-fe30-11ee-a1b3-94de80a79d0c': '10100110100100100100101100100100100',
    '7_f34516f7-fe30-11ee-8092-94de80a79d0c': '111111111',
    '4_f34516f8-fe30-11ee-8ebf-94de80a79d0c': '1111111111111011011',
    '5_f3458c28-fe30-11ee-8c80-94de80a79d0c': '100101111110101011010101101001',
    '7_f3458c29-fe30-11ee-9feb-94de80a79d0c': '111111111',
    '4_f3458c2a-fe30-11ee-8d5f-94de80a79d0c': '1111111111111011011',
    '1_f3458c2b-fe30-11ee-abab-94de80a79d0c': '111111111111',
    '9_f3458c2c-fe30-11ee-a38b-94de80a79d0c': '1010010101010101010101010101100100100100',
    '2_f345b338-fe30-11ee-b109-94de80a79d0c': '10100101101010101011111111101',
    '6_f345b339-fe30-11ee-ba3f-94de80a79d0c': '10100110100100100100101100100100100',
    '0_f345b33a-fe30-11ee-af3e-94de80a79d0c': '1010100110101010110010',
    '8_f345b33b-fe30-11ee-b6be-94de80a79d0c': '1010101010101101010101010110010010101010010010',
    '3_f345b33c-fe30-11ee-b8e5-94de80a79d0c': '1011110101011010010110010110101101001',
    '3_f202cd9d-0070-11ef-97d5-94de80a79d0c': '1010110101101011001001011010010111101',
    '8_59da2a06-0054-11ef-87b6-94de80a79d0c': '101010101010110100101010110010010101010010010',
    '0_92192191-0056-11ef-942e-94de80a79d0c': '1010100101101011010110101',
    '0_f7aa8276-0069-11ef-8985-94de80a79d0c': '101001011010110100110101',
    '5_f7aaf7ac-0069-11ef-8b70-94de80a79d0c': '11111110101010101011010000101',
}


def font_to_xml(font_path):
    """
    woff转xml
    :param font_path:
    :return:
    """
    font_list = os.listdir(font_path)
    for file_name in font_list:
        if file_name[-5:] == '.woff' and f'{file_name[:-5]}.xml' not in font_list:
            print(f'正在转换{file_name}')
            font = TTFont(f'{font_path}/{file_name}')
            font.saveXML(f'{font_path}/{file_name[:-5]}.xml')
            print(f'{file_name}转换完成')


def font_outline(font_path):
    """
    字符轮廓数据
    :param font_path:
    :return:
    """
    font_1 = {
        'unif71b6': 0, 'unif7229': 1, 'unif720c': 2, 'unif7239': 3, 'unif725d': 4,
        'unif72e6': 5, 'unif71d2': 6, 'unif7157': 7, 'unif72c8': 8, 'unif727f': 9
    }
    font_2 = {
        'unif81cc': 0, 'unif8257': 1, 'unif82b0': 2, 'unif829e': 3, 'unif8151': 4,
        'unif80f6': 5, 'unif81f1': 6, 'unif81bd': 7, 'unif81de': 8, 'unif8254': 9
    }
    font_3 = {
        'unif8967': 0, 'unif89ab': 1, 'unif895e': 2, 'unif89e2': 3, 'unif896a': 4,
        'unif89a7': 5, 'unif8901': 6, 'unif8a7f': 7, 'unif8a3c': 8, 'unif8965': 9
    }
    font_4 = {
        'unif60e3': 0, 'unif60ac': 1, 'unif6006': 2, 'unif6048': 3, 'unif616b': 4,
        'unif60cd': 5, 'unif611e': 6, 'unif614b': 7, 'unif60ca': 8, 'unif6050': 9
    }
    font_5 = {
        'unif7c61': 0, 'unif7b8f': 1, 'unif7bcb': 2, 'unif7cca': 3, 'unif7b7a': 4,
        'unif7af6': 5, 'unif7c0f': 6, 'unif7b48': 7, 'unif7c9f': 8, 'unif7bba': 9
    }
    font_list = [font_1, font_2, font_3, font_4, font_5]
    xml_list = glob(f'{font_path}/*.xml')
    font_outline_data = {}
    for index, xml_file in enumerate(xml_list[:-1]):
        with open(xml_file, 'rb') as file:
            root = etree.XML(file.read())
            TTGlyph_list = root.xpath('./glyf/TTGlyph')[1:]
            keys_name_list = font_list[index].keys()
            for i in TTGlyph_list:
                code_name = i.xpath('./@name')[0]
                if code_name not in keys_name_list:
                    continue
                pt_on = i.xpath('.//pt/@on')
                font_outline_data[f'{code_name}_{uuid1()}'] = ''.join(pt_on)
    return font_outline_data


def font_map(font_data):
    """
    字符轮廓的构建
    :param font_data:
    :return:
    """
    font_1 = {
        'unif71b6': 0, 'unif7229': 1, 'unif720c': 2, 'unif7239': 3, 'unif725d': 4,
        'unif72e6': 5, 'unif71d2': 6, 'unif7157': 7, 'unif72c8': 8, 'unif727f': 9
    }
    font_2 = {
        'unif81cc': 0, 'unif8257': 1, 'unif82b0': 2, 'unif829e': 3, 'unif8151': 4,
        'unif80f6': 5, 'unif81f1': 6, 'unif81bd': 7, 'unif81de': 8, 'unif8254': 9
    }
    font_3 = {
        'unif8967': 0, 'unif89ab': 1, 'unif895e': 2, 'unif89e2': 3, 'unif896a': 4,
        'unif89a7': 5, 'unif8901': 6, 'unif8a7f': 7, 'unif8a3c': 8, 'unif8965': 9
    }
    font_4 = {
        'unif60e3': 0, 'unif60ac': 1, 'unif6006': 2, 'unif6048': 3, 'unif616b': 4,
        'unif60cd': 5, 'unif611e': 6, 'unif614b': 7, 'unif60ca': 8, 'unif6050': 9
    }
    font_5 = {
        'unif7c61': 0, 'unif7b8f': 1, 'unif7bcb': 2, 'unif7cca': 3, 'unif7b7a': 4,
        'unif7af6': 5, 'unif7c0f': 6, 'unif7b48': 7, 'unif7c9f': 8, 'unif7bba': 9
    }
    font_list = [font_1, font_2, font_3, font_4, font_5]
    for font_map in font_list:
        for key, value in font_map.items():
            font_data = str(font_data).replace(key, str(value))
    return font_data


def similarity_comparison(test_f, sample_f):
    """
    相似度比较
    :param test_f:
    :param sample_f:
    :return:
    """
    result_font_map = {}
    for test_key, test_value in test_f.items():
        possibility = 0
        for sample_key, sample_value in sample_f.items():
            mid_similarity = SequenceMatcher(None, test_value, sample_value).ratio()
            if mid_similarity >= possibility:
                possibility = mid_similarity
                result_font_map.update({test_key.split('_', 1)[0].lower(): sample_key[0]})
    return result_font_map


def font_analyse(font_str, file_name=None, file_dir='cracking_fonts'):
    """
    字体解析
    :param font_str:
    :param file_name:
    :param file_dir:
    :return:
    """
    bin_data = base64.decodebytes(font_str.encode())
    file = BytesIO()
    file.write(bin_data)
    font_obj = TTFont(file)
    file.close()
    glyphs_dict = dict()
    error_list = list()
    for name in font_obj.getGlyphNames():
        try:
            coordinates = list(font_obj['glyf'][name].coordinates)
        except:
            continue
        else:
            glyph = hashlib.md5(str(coordinates).encode('utf-8')).hexdigest()
            try:
                value = FONT_DICT[glyph]
            except:
                error_list.append(name)
            else:
                glyphs_dict[name] = value
    # 处理error_list
    file_name = f'{uuid1()}.woff' if not file_name else file_name
    full_path = Path(__file__).absolute().parent / file_dir
    if not full_path.exists():
        full_path.mkdir()
    font_obj.saveXML(f'{full_path}/{file_name[:-5]}.xml')
    font_outline_data = {}
    with open(f'{full_path}/{file_name[:-5]}.xml', 'rb') as file:
        root = etree.XML(file.read())
        TTGlyph_list = root.xpath('./glyf/TTGlyph')[1:]
        keys_name_list = error_list
        for i in TTGlyph_list:
            code_name = i.xpath('./@name')[0]
            if code_name not in keys_name_list:
                continue
            pt_on = i.xpath('.//pt/@on')
            font_outline_data[f'{code_name}_{uuid1()}'] = ''.join(pt_on)
    os.remove(f'{full_path}/{file_name[:-5]}.xml')
    similarity_result = similarity_comparison(font_outline_data, sample_font)
    ret_dict = {**glyphs_dict, **similarity_result}
    return ret_dict


if __name__ == '__main__':
    font_str = "d09GRgABAAAAABXEAAsAAAAAIIwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAASAAAAGRsim0RY21hcAAAAYwAAAF6AAAEQl7pC7VnbHlmAAADCAAADpgAABNEWDGM52hlYWQAABGgAAAAMQAAADYq8nklaGhlYQAAEdQAAAAeAAAAJA+2BixobXR4AAAR9AAAAJ8AAAD8KY//MmxvY2EAABKUAAAAgAAAAICVyJqQbWF4cAAAExQAAAAfAAAAIAFMADpuYW1lAAATNAAAAW8AAALBIKl0snBvc3QAABSkAAABHgAAAtEN9KO6eJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGXZyTiBgZWBgVWLPYWBgbEKQrMKMrQw7WRgYGJgZWbACgLSXFMYDvwHAo7yvy8YPnNmMUkAhRlRFDExMPz/DwC/MhBneJzt07tOVFEcRvE1gKCgbkTEK95QFFS8X0C0IhQaY2Vs6CnP4FtAY6xsLQzEREsaCixMfAA6Ex/AxsRYGBIx47dXfAzP5DcrZ+fkzOw5/wF2Ad1xOXqg9YgW9ZjLasv1bvpd7+FIzrvyytHpyGtbvfw/9ta3ru1/Zw8pzRXBpfS64Fp6W/AgvaP6BEpzX3AvfSwYSZ8I9qcLgqPpC0G9x7LgbroiOJW+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